from Page.Page import Page
from selenium.webdriver.common.by import By

# 删除收货地址
class Page1(Page):
    # 定位器
    # 我的酒仙
    wode_loc = (By.XPATH,'/html/body/div[2]/div/div[2]/ul/li[1]/div[1]/a')
    # 收货地址
    address_btn_loc = (By.XPATH,'/html/body/div[4]/div[1]/div[2]/div[4]/a[3]')
    # 删除
    delete_address_loc = (By.XPATH,'/html/body/div[4]/div[3]/div[2]/div[1]/table/tbody/tr[2]/td[4]/a[2]')
    # 确定删除
    sure_delete_loc = (By.XPATH,'/html/body/div[8]/div/div[3]/span[1]')
    # 再确定
    sure_zai_loc = (By.XPATH,'/html/body/div[8]/div/div[3]/span[1]')

    # 封装方法
    # 我的酒仙
    def wode(self):
        self.click(self.wode_loc)
    # 收货地址
    def address_btn(self):
        self.click(self.address_btn_loc)
    # 删除
    def delete_address(self):
        self.click(self.delete_address_loc)
    # 确定
    def sure_delete(self):
        self.click(self.sure_delete_loc)
    # 确定
    def sure_zai(self):
        self.click(self.sure_zai_loc)

    # 业务逻辑
    def page1_luoji(self):
        self.wode()
        self.new_window()
        self.scroll_To(800)
        self.address_btn()
        self.delete_address()
        self.sure_delete()
        self.sure_zai()
